package bat.ke.qq.com;

import bat.ke.qq.com.bean.Fox;
import bat.ke.qq.com.bean.User;
import bat.ke.qq.com.common.CustomTypeFilter;
import bat.ke.qq.com.common.MyImportBeanDefinitionRegistrar;
import bat.ke.qq.com.common.MyImportSelector;
import bat.ke.qq.com.service.UserService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.*;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 *
 */
//@ImportResource("spring.xml")
@ComponentScan("bat.ke.qq.com")
//@ComponentScan(basePackages = "bat.ke.qq.com",excludeFilters = {
//    @ComponentScan.Filter(type = FilterType.ANNOTATION,value = {Service.class}),
//    @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,value = {User.class})
//})
//@ComponentScan(basePackages = "bat.ke.qq.com",includeFilters = {
//    @ComponentScan.Filter(type = FilterType.CUSTOM,value = {CustomTypeFilter.class})
//},useDefaultFilters = false)
@Configuration
@Import({MyImportBeanDefinitionRegistrar.class}) // 利用@Import注解实现
public class AppConfig {

    @Bean
    public User user() {
        return new User();
    }

    @Bean
    public UserService userService() {
        return new UserService(user());
    }

//
//    @Bean
//    public UserService userService(){
//        // 调用其他@Bean方法   多例   context.getBean()
//        return new UserService(user());
//    }

//    @Bean
//    public User user2(){
//        return new User();
//    }

//    @Bean
//    public Fox fox(){
//        return new Fox();
//    }


}
